package userrouter

import (
	"vpn-management-server/src/controller/usercontroller"
	"vpn-management-server/src/interceptor/userinterceptor"
	"vpn-management-server/src/router/routermodel"
)

var userRouter = routermodel.NewRouter()

func init() {
	userRouter.RegisterHandleSet("simAuth", userinterceptor.UserSimAuthValidator, usercontroller.SimAuth, nil)
	userRouter.RegisterHandleSet("simAuthStatus", userinterceptor.UserSimAuthStatusValidator, usercontroller.SimAuthStatus, userinterceptor.AddUserLogToChan)

	userRouter.RegisterHandleSet("register", userinterceptor.UserValidator, usercontroller.Register, userinterceptor.AddUserLogToChan)
	userRouter.RegisterHandleSet("tokenRegister", userinterceptor.UserTokenRegisterValidator, usercontroller.TokenRegister, userinterceptor.AddUserLogToChan)
	userRouter.RegisterHandleSet("login", userinterceptor.UserLoginValidator, usercontroller.Login, nil)
	userRouter.RegisterHandleSet("tokenLogin", userinterceptor.UserLoginValidator, usercontroller.TokenLogin, nil)
	userRouter.RegisterHandleSet("singleLogin", userinterceptor.UserTokenRegisterValidator, usercontroller.SingleLogin, userinterceptor.AddUserLogToChan)
	userRouter.RegisterHandleSet("reset", userinterceptor.UserResetValidator, usercontroller.Reset, nil)
	userRouter.RegisterHandleSet("deleteUserByID", userinterceptor.UserNameInfoValidator, usercontroller.DeleteUserByID, userinterceptor.DeleteUserLogToChan)
	userRouter.RegisterHandleSet("deleteUserByName", userinterceptor.UserNameValidator, usercontroller.DeleteUserByName, nil)
	userRouter.RegisterHandleSet("revokeUserByID", userinterceptor.UserNameInfoValidator, usercontroller.RevokeUserByID, userinterceptor.RevokeUserLogToChan)
	userRouter.RegisterHandleSet("recoverUserByID", userinterceptor.UserNameInfoValidator, usercontroller.RecoverUserByID, userinterceptor.RecoverUserLogToChan)
	userRouter.RegisterHandleSet("getUserByName", userinterceptor.UserNameInfoValidator, usercontroller.GetUserByName, nil)
	userRouter.RegisterHandleSet("resetUserPassword", userinterceptor.UserResetByAdminValidator, usercontroller.ResetUserPassword, userinterceptor.ResetUserLogToChan)
}
